package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.DeviceDetail;
import com.indusfo.spc.service.DeviceDetailService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 设备明细
 *
 * @author WangQ
 *
 * @version 创建时间：2019年12月30日 上午10:36
 */

@Controller
@RequestMapping("/service/deviceDetail")
public class DeviceDetailController {

    @Autowired
    private DeviceDetailService deviceDetailService;

    /**
     * 	查询设备明细
     * @param deviceDetail
     * @return
     */
    @RequestMapping("/queryDeviceDetail")
    @SystemControllerLog(description="查询设备明细")
    @ResponseBody
    public JSONObject queryDeviceDetail(DeviceDetail deviceDetail) {
        JSONObject jsonObject = deviceDetailService.queryDeviceDetail(deviceDetail);
        return jsonObject;
    }

    /**
     *	 删除设备明细
     * @param deviceDetailIds
     * @param dataState
     * @return
     */
    @RequestMapping("/deleteDeviceDetail")
    @ResponseBody
    public JSONObject deleteDeviceDetail(Long[] deviceDetailIds, Integer dataState) {
        dataState = 2;
        JSONObject jsonObject = deviceDetailService.definedDeviceDetail(deviceDetailIds, dataState);
        return jsonObject;
    }

    /**
     * 启用停用设备明细
     * @param deviceDetailIds
     * @param dataState
     * @return
     */
    @RequestMapping("/definedDeviceDetail")
    @ResponseBody
    public JSONObject definedDeviceDetail(Long[] deviceDetailIds, Integer dataState) {
        JSONObject jsonObject = deviceDetailService.definedDeviceDetail(deviceDetailIds, dataState);
        return jsonObject;
    }

    /**
     *	 新增设备明细
     * @param deviceDetail
     * @return
     */
    @RequestMapping("/insertDeviceDetail")
    @ResponseBody
    public JSONObject insertDeviceDetail(DeviceDetail deviceDetail) {
        JSONObject jsonObject = deviceDetailService.insertDeviceDetail(deviceDetail);
        return jsonObject;
    }

    /**
     * 	修改设备明细
     * @param deviceDetail
     * @return
     */
    @RequestMapping("/updateDeviceDetail")
    @ResponseBody
    public JSONObject updateDeviceDetail(DeviceDetail deviceDetail) {
        JSONObject jsonObject = deviceDetailService.updateDeviceDetail(deviceDetail);
        return jsonObject;
    }
}
